  <?php

header('Content-Type:text/html;Charset=utf-8;');
include "rsa.php";


$pubfile = 'rsa.pem';
$prifile = '';
$rsa = new RSA($pubfile, $prifile);

$username = '李四';
$id='140144444444441111';


//加密
$username = $rsa->encrypt($username);
$id = $rsa->encrypt($id);


$url = 'http://183.203.216.206:8800/tywscx/mobile/hmSendMessageAction!sendMessage.do';
$data  = '{"request_username": "sxyzy","request_password": "sxyzy2014","request_uuid": "123456789","request_data": {"ywbh": "123456789","mobile": "13734027639","content": "您好","send_type": "2","user_name": "'.$username.'","id_no": "'.$id.'"}}';
var_dump($data);
$curl = curl_init();  //初始化
curl_setopt($curl,CURLOPT_URL,$url);  //设置url
curl_setopt($curl,CURLOPT_HTTPAUTH,CURLAUTH_BASIC);  //设置http验证方法
curl_setopt($curl,CURLOPT_HEADER,0);  //设置头信息
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);  //设置curl_exec获取的信息的返回方式
curl_setopt($curl,CURLOPT_POST,1);  //设置发送方式为post请求
curl_setopt($curl,CURLOPT_POSTFIELDS,$data);  //设置post的数据

$result = curl_exec($curl);
var_dump($result);

curl_close($curl);

